package com.huxiaoshou.exam.common;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public Result<?> exception(Exception e) {
        log.error("服务器发生运行时异常！异常信息为：{}", e.getMessage());
        return Result.error(e.getMessage());
    }
}